# -*- encoding: utf-8 -*-
"""
File Name: agent_health_check
Description:
Author : 'lirui'
date: 2024/11/5
Contact: marjey_lee@163.com
Change Activity:
2024/11/5:
"""
import requests

import ll

_MAPPING = {
    'internal_zabbix': 'http://188.12.26.38:900/health_check',
    'external_zabbix': 'http://189.21.16.14:9033/health_check',
    'dedicated_line': 'http://189.12.16.41:902/health_check',
    'branch_line': 'http://189.12.16.41:903/health_check',
}


class AgentHealthCheck:

    def __call__(self):
        ret = {}
        for k, v in _MAPPING.items():
            try:
                res = requests.get(v)
                ret[k] = res.text
            except Exception as e:
                ll.get_logger().error(e)
                ret[k] = 'False'
        return ret


def _main():
    r = AgentHealthCheck()()
    print(r)

if __name__ == '__main__':
    _main()
